home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / Kubuntu 8.10 / kubuntu-8.10-desktop-i386.iso / casper / filesystem.squashfs / lib / init / splash-functions < prev    next >
Text File  |  2008-05-27  |  2KB  |  94 lines

  1. # Usplash hooks for /lib/init/splash-functions-base
  2.  
  3. # Internal function, do not use in external scripts
  4. usplash_pidfound()
  5. {
  6.     pidof usplash > /dev/null 2>&1 || return 1
  7.     return 0
  8. }
  9.  
  10. splash_running()
  11. {
  12.     if [ -x /sbin/usplash ] && usplash_pidfound; then
  13.         return 0
  14.     fi
  15.     return 1
  16. }
  17.  
  18. splash_stop()
  19. {
  20.     local i
  21.  
  22.     splash_running || return 0
  23.  
  24.     # Wait until it is gone or forcibly kill it
  25.     i=0
  26.     while usplash_pidfound; do
  27.         i=$(($i + 1))
  28.         if [ $i -gt 10 ]; then
  29.             kill -9 $(pidof usplash)
  30.             break
  31.         fi
  32.         sleep 0.1
  33.     done
  34.     return 0
  35. }
  36.  
  37. splash_start()
  38. {
  39.     if splash_running; then
  40.         return 0
  41.     elif [ ! -x /sbin/usplash ] || [ ! -x /sbin/usplash_down ]; then
  42.         return 1
  43.     fi
  44.  
  45.     /sbin/usplash_down || return 1
  46.     return 0
  47. }
  48.  
  49. custom_splash_progress()
  50. {
  51.     splash_running || return 0
  52.     /sbin/usplash_write "PROGRESS $1" || return 1
  53.     return 0
  54. }
  55.  
  56. splash_start_indefinite()
  57. {
  58.     splash_running || return 0
  59.     # TIMOUT 0 is not indefinite
  60.     /sbin/usplash_write "TIMEOUT 600" || return 1
  61.     /sbin/usplash_write "PULSATE" || return 1
  62.     return 0
  63. }
  64.  
  65. splash_stop_indefinite()
  66. {
  67.     splash_running || return 0
  68.     /sbin/usplash_write "TIMEOUT 15" || return 1
  69.     return 0
  70. }
  71.  
  72. splash_user_input()
  73. {
  74.     splash_running || return 1
  75.     [ -p /dev/.initramfs/usplash_outfifo ] || return 1
  76.  
  77.     case "$2" in
  78.         regular)
  79.         /sbin/usplash_write "INPUT $1" || return 1
  80.         ;;
  81.         password)
  82.         /sbin/usplash_write "INPUTQUIET $1" || return 1
  83.         ;;
  84.         enter)
  85.         /sbin/usplash_write "INPUTENTER $1" || return 1
  86.         ;;
  87.         *)
  88.         return 1
  89.         ;;
  90.     esac
  91.     cat /dev/.initramfs/usplash_outfifo 2> /dev/null || return 1
  92.     return 0
  93. }
  94.